<?php

include '../DB/dbConnection.php';

$result=array();

if ($_GET){
	
	$query="SELECT * FROM achivment WHERE student_id=".$_GET['student_id']." AND school_id=".$_GET['school_id'];
		
	$stmt = $conn->prepare($query);
	$success = $stmt->execute();
	$stmt->bind_result($id, $achivment, $student_id, $school_id, $datetime);

	
	$final=array();
	
	while ($stmt->fetch())
	{
		$tmp=array();
		$tmp['id']=$id;
		$tmp['achivment']=$achivment;
		$tmp['student_id']=$student_id;
		$tmp['school_id']=$school_id;
		$tmp['datetime']=$datetime;
			
		array_push($final,$tmp);
	}

	$stmt->close();
	$conn->close();
		
	if($success)
	{
		$result['error']='false';
		$result['list']=$final;
	}
	else
		$result['error']='true';
}
else
{
	$result['error']='true';
}

echo json_encode($result);


?> 
